﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace System.Web.Mvc.Html
{
    public static class HtmlExtensions
    {
        public static MvcHtmlString Action<TController>(this HtmlHelper htmlHelper,
            Expression<Action<TController>> action) where TController : Controller
        {
            string controllerName = MvcHelper.GetControllerName<TController>();
            MethodCallExpression call = action.Body as MethodCallExpression;
            string actionName = call.Method.Name;
            return htmlHelper.Action(actionName, controllerName, ExpressionHelper2.GetRouteValues(action));
        }
    }
}
